﻿package mortal.game.net.command.group
{
    import Framework.MQ.*;
    import Message.Public.*;
    import com.gengine.debug.*;
    import extend.language.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.game.view.copy.groupCopy.data.*;
    import mortal.mvc.core.*;

    public class GroupLeaveCommand extends BroadCastCall
    {

        public function GroupLeaveCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:GroupCopyLeaveOperData = null;
            var _loc_3:Array = null;
            var _loc_4:SGroupOper = null;
            var _loc_5:EArenaMode = null;
            Log.debug("I have receive GroupLeaveCommand");
            _cache.group.disbanGroup();
            MsgManager.showRollTipsMsg(Language.getString(30246));
            NetDispatcher.dispatchCmd(ServerCommand.GroupPlayerInfoChange, _cache.group.players);
            NetDispatcher.dispatchCmd(ServerCommand.CaptainChange, null);
            if (Cache.instance.group.groupCopyLeaveOperData)
            {
                _loc_2 = Cache.instance.group.groupCopyLeaveOperData;
                if (_loc_2.type == GroupCopyLeaveOperData.Apply)
                {
                    _loc_3 = new Array();
                    _loc_4 = _loc_2.sgroupOper;
                    _loc_3.push(_loc_4);
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GroupApplyOper, _loc_3));
                }
                else if (_loc_2.type == GroupCopyLeaveOperData.Create)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.CopyGroupCreate, _loc_2.tcopy));
                }
                else if (_loc_2.type == GroupCopyLeaveOperData.FastEnterGroup)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.CopyGroupQuickReq, _loc_2.tcopy));
                }
                else if (_loc_2.type == GroupCopyLeaveOperData.RegisterArena)
                {
                    _loc_5 = new EArenaMode(EArenaMode._EArenaOneVsMulti);
                    GameProxy.copy.signUpArena(ECopyType._ECopyTypeArena, false, _loc_5);
                }
                else if (_loc_2.callBack != null)
                {
                    _loc_2.callBack.apply(null, _loc_2.prame);
                }
            }
            Cache.instance.group.groupCopyLeaveOperData = null;
            return;
        }// end function

    }
}
